home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / slib / tk / demos / mkEntry.tcl < prev    next >
Text File  |  1994-09-20  |  2KB  |  30 lines

  1. # mkEntry w
  2. #
  3. # Create a top-level window that displays a bunch of entries.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkEntry {{w .e1}} {
  9.     catch {destroy $w}
  10.     toplevel $w
  11.     dpos $w
  12.     wm title $w "Entry Demonstration"
  13.     wm iconname $w "Entries"
  14.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 200 \
  15.         -text "Three different entries are displayed below.  You can add characters by pointing, clicking and typing.  You can delete by selecting and typing Control-d.  Backspace, Control-h, and Delete may be typed to erase the character just before the insertion point, Control-W erases the word just before the insertion point, and Control-u clears the entry.  For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button 2 pressed.  Click the \"OK\" button when you've seen enough."
  16.     frame $w.frame -borderwidth 10
  17.     button $w.ok -text OK -command "destroy $w"
  18.     pack $w.msg $w.frame $w.ok -side top -fill both
  19.  
  20.     entry $w.frame.e1 -relief sunken
  21.     entry $w.frame.e2 -relief sunken
  22.     entry $w.frame.e3 -relief sunken
  23.     pack $w.frame.e1 $w.frame.e2 $w.frame.e3 -side top -pady 5 -fill x
  24.  
  25.     $w.frame.e1 insert 0 "Initial value"
  26.     $w.frame.e2 insert end "This entry contains a long value, much too long "
  27.     $w.frame.e2 insert end "to fit in the window at one time, so long in fact "
  28.     $w.frame.e2 insert end "that you'll have to scan or scroll to see the end."
  29. }
  30.